/* 项目：三员分离【检查批处理密级】 作者：shijiankui 时间：2016-08-15 start */
    /**
     * 检查密级（affairId、subObjectId、fileId 三选一即可）
     * @param affairId 个人事项ID
     * @param subObjectId 个人事项subObjectId
     * @param fileId 公文ID或协同ID或文档ID
     * @param type 0 - 公文，1 - 协同，2 - 文档
     * @param basePath 根路径
     */

// function checkBatchRight(affairId, subObjectId, fileId, type, basePath) {
//      var tag = false;
//      
//      var showType;
//      if (type == 0) {
//        showType = "公文";
//      } else if (type == 1) {
//        showType = "协同";
//      } else if (type == 2) {
//        showType = "文档";
//      } else {
//        showType = "文件";
//      }
//      
//      var urlValue;
//      if (basePath) {
//        urlValue = basePath + '/securitymanage/CheckSecret.do?method=checkRights';
//      } else {
//        urlValue = 'securitymanage/CheckSecret.do?method=checkRights';
//      }
//
//      var dataValue = {
//        affairId: affairId,
//        subObjectId: subObjectId,
//        fileId: fileId,
//        type: type,
//        whichMachineFileMap: 0 // 检查打开
//      };
//
//      $.ajax({
//        url: urlValue,
//        data: dataValue,
//        type: 'post',
//        async: false, // 同步
//        datatype: 'json',
//        success: function(data) {
//          if (data) { // 有返回数据
//            if (data.machineRight == undefined) {
//              data = eval("(" + data + ")");
//            }
//            if (data.machineRight == "true") { // 设备密级满足
//              tag = true;
//            } else if (data.machineRight == "false") {
//              alert("设备密级不足，无法批处理此密级的" + showType + "！");
//            } else {
//              alert("密级检查出错！(e000)");
//            }
//          } else {
//            alert("密级检查出错！(e001)");
//          }
//        },
//        error: function() {
//          alert("密级检查出错！(e002)");
//        }
//      });
//
//      return tag;
//    }
    /* 项目：三员分离【检查转发密级】 作者：shijiankui 时间：2016-08-15 end */
    
    
    
/* 项目：三员分离【Ajax同步检查密级】 作者：jinshiyu 时间：2016-08-04 start */
/**
 * 检查密级（affairId、subObjectId、fileId 三选一即可）
 * @param affairId 个人事项ID
 * @param subObjectId 个人事项subObjectId
 * @param fileId 公文ID或协同ID或文档ID
 * @param type 0 - 公文，1 - 协同，2 - 文档
 * @param basePath 根路径
 */
function checkRight(affairId, subObjectId, fileId, type, basePath) {
  var tag = false;
  
  var showType;
  if (type == 0) {
    showType = "公文";
  } else if (type == 1) {
    showType = "协同";
  } else if (type == 2) {
    showType = "文档";
  } else {
    showType = "文件";
  }

  var urlValue;
  if (basePath) {
    urlValue = basePath + '/securitymanage/CheckSecret.do?method=checkRights';
  } else {
    urlValue = 'securitymanage/CheckSecret.do?method=checkRights';
  }

  var dataValue = {
    affairId: affairId,
    subObjectId: subObjectId,
    fileId: fileId,
    type: type
  };

  $.ajax({
    url: urlValue,
    data: dataValue,
    type: 'post',
    async: false, // 同步
    datatype: 'json',
    success: function(data) {
      if (data) { // 有返回数据
        if (data.machineRight == undefined) {
          data = eval("(" + data + ")");
        }
        if (data.machineRight == "true") { // 设备密级满足
          if (data.personRight == "true") { // 人员密级满足
            tag = true;
          } else if (data.personRight == "false") {
            alert("人员密级不足，无法打开此密级的" + showType + "！");
          } else {
            //lert("密级检查出错！(e000)");
			tag = true;
          }
        } else if (data.machineRight == "false") {
          alert("设备密级不足，无法打开此密级的" + showType + "！");
        } else {
          //alert("密级检查出错！(e000)");
		  tag = true;
        }
      } else {
        alert("密级检查出错！(e001)");
      }
    },
    error: function() {
      alert("密级检查出错！(e002)");
    }
  });

  return tag;
}
/* 项目：三员分离【Ajax同步检查密级】 作者：jinshiyu 时间：2016-08-04 end */

//批处理
function batchDeal(){
    var rows = grid.grid.getSelectRows();
    if(rows.length == 0){
        $.alert($.i18n('collaboration.listPending.selectBatchData')); //请选择要删除的记录
        return;
    }
    var process = new BatchProcess();
    for(var i = 0 ; i < rows.length;i++){
        var affairId = rows[i].affairId;
        /* 项目：三员分离【检查协同批处理】 作者：jinshiyu 时间：2016-08-16 start */
        if (!checkRight(affairId, null, null, 1, _ctxPath)) {
            return;
        }
        /* 项目：三员分离【检查协同批处理】 作者：jinshiyu 时间：2016-08-16 end */
       
        var subject = rows[i].subject;
        var category =  rows[i].category||"1";
        var summaryId =  rows[i].summaryId;
        if(process.batchOpinion == "0" || process.batchOpinion == null){
        	process.batchOpinion = rows[i].disAgreeOpinionPolicy == null ? "0": rows[i].disAgreeOpinionPolicy=="1" ? "3":"0";//意见是否必填，3,不同意时，意见必填
        }
        process.addData(affairId,summaryId,category,subject);
    }
    
    if(!process.isEmpty()){
        var r = process.doBatch();
    }
    //try{window.location.reload();}catch(e){}
}


//取消加粗
function cancelBold(rowIndex){
    var obj = $("tr:eq("+rowIndex+")").find(".font_bold");
    if(obj!=null && typeof(obj)!='undefined')  obj.removeClass("font_bold");
}
function rend(txt, data, r, c) {
    //未读  11  加粗显示
    var subState = data.subState;
    if(subState == 11){
        txt = "<span class='font_bold'>"+txt+"</span>";
    }
    if(c===10){
    	if(data.fileSecretName=="秘密"){
  	   	  txt = "<span style='color:red'>"+txt+"</span>";
  		 }
       }
    if(c == 1){
    	//标题列加深
	    txt="<span class='grid_black'>"+txt+"</span>";
        //如果是代理 ，颜色变成蓝色
        if(data.proxy){
            txt = "<span class='color_blue'>"+txt+"</span>";
        }
        //加图标
        //重要程度
        if(data.importantLevel !=""&& data.importantLevel != 1){
            txt = "<span class='ico16 important"+data.importantLevel+"_16 '></span>"+ txt;
        }
        //附件
        if(data.hasAttsFlag == true){
            txt = txt + "<span class='ico16 affix_16'></span>" ;
        }
        //协同类型
        if(data.bodyType!=""&&data.bodyType!=null&&data.bodyType!="10"&&data.bodyType!="30"){
            txt = txt+ "<span class='ico16 office"+data.bodyType+"_16'></span>";
        }
        //流程状态
        if(data.state != null && data.state !="" && data.state != "0"){
            txt = "<span class='ico16  flow"+data.state+"_16 '></span>"+ txt ;
        }
        //如果设置了处理期限(节点期限),添加超期图标
        if(data.nodeDeadLineName !=$.i18n('collaboration.project.nothing.label')){
            if(data.isCoverTime){
                //超期图标
                txt = txt + "<span class='ico16 extended_red_16'></span>" ;
            }else{
                //未超期图标
                txt = txt + "<span class='ico16 extended_blue_16'></span>" ;
            }
        }
    } else if(c == 6){
        if(data.isCoverTime){
            //超期图标
            txt = "<span class='color_red'>"+txt+"</span>" ;
        }
    }else if(c == 8){
        var titleTip = subState;
        if (subState == 16 || subState == 17 || subState == 18 ) {
           titleTip  = 16;
        };
        var toolTip = $.i18n('collaboration.toolTip.label' + subState);
        var backFromId = data.backFromId;
        var isBackfrom = false;
        if (backFromId != null) {
            isBackfrom = true;
        }
        if(isBackfrom && subState != 13 && subState != 15 && subState != 17){//被回退并且暂存待办后不显示。被回退图标
            toolTip = $.i18n('collaboration.toolTip.label' + 16);
//            if(subState ==15 || subState ==16){
//            	toolTip =$.i18n("collaboration.default.stepBack");
//            }
            return "&nbsp;<span class='ico16 be_rolledback_16' title='"+ toolTip +"'></span>&nbsp;" ;
        }else if(subState == 12) {
        	
            return "&nbsp;<span class='ico16 viewed_16' title='"+ toolTip +"'></span>&nbsp;" ;
        }else{
        	if(subState ==15 || subState == 17){
            	toolTip =$.i18n("collaboration.default.stepBack");
            	if(subState == 17){
            		//指定回退中间节点的时候按照指定回退发起方显示图标
            		subState = 15; 
            	}
            }
            return "&nbsp;<span class='ico16 pending" + subState + "_16' title='"+ toolTip +"'></span>&nbsp;" ;
        }
    }else if (c == 9){
        return "&nbsp;<a class='ico16 view_log_16 noClick' href='javascript:void(0)' onclick='showDetailLogDialog(\""+data.summaryId+"\",\""+data.processId+"\",2)'></a>&nbsp;";
    }
    return txt;
}

//点击事件
function dbclickRow(data,rowIndex, colIndex){
	/* jinshiyu ajax方法推送affairId 和type 给collarbrationController 2016-8-4 start */
	  var affairId = data.affairId;
	  if (!checkRight(affairId, null, null, 1, _ctxPath)) {
	    return;
	  }
	  /* jinshiyu ajax方法推送affairId 和type 给collarbrationController 2016-8-4 end */
 
    //取消加粗
    //cancelBold(rowIndex);
    $("#listPending tr").eq(rowIndex).find("span").removeClass("font_bold");

    if(!isAffairValid(data.affairId)){
        $("#listPending").ajaxgridLoad();
        return;
    }
    var url = _ctxPath + "/collaboration/collaboration.do?method=summary&openFrom=listPending&affairId="+data.affairId;
    var title = data.subject;
    doubleClick(url,escapeStringToHTML(title));
    grid.grid.resizeGridUpDown('down');
    //页面底部说明加载
    $('#summary').attr("src",_ctxPath + "/collaboration/listDesc.do?method=listDesc&type=listPending&size="+grid.p.total+"&r=" + Math.random());
}
//删除
function deleteCol(){
    deleteItems('pending',grid,'listPending',paramMethod);
}

function transmitCol(){
    transmitColFromGrid(grid);
}

var grid;
var searchobj;
$(document).ready(function () {
    new MxtLayout({
        'id': 'layout',
        'northArea': {
            'id': 'north',
            'height': 40,
            'sprit': false,
            'border': false
        },
        'centerArea': {
            'id': 'center',
            'border': false,
            'minHeight': 20
        }
    });
    var submenu = new Array();
    //判断是否有新建协同的资源权限，如果没有则屏蔽转发协同
    if ($.ctx.resources.contains('F01_newColl')) {
        //协同
        submenu.push({name: $.i18n('collaboration.transmit.col.label'),click: transmitCol });
    };
    //判断是否有转发邮件的资源权限，如果没有则屏蔽转发协同
    if ($.ctx.resources.contains('F12_mailcreate')) {
        //邮件
    	/*if (emailShow) {
    		submenu.push({name: $.i18n('collaboration.transmit.mail.label'),click: transmitMail });
    	}*/
    	/* 项目：重庆建设三员分离【屏蔽协同转邮件】 作者：wxt.fengyunyun 时间：2017年2月15日14:23:58 start 
    	if (!emailNotShow) {
    		submenu.push({name: $.i18n('collaboration.transmit.mail.label'),click: transmitMail });
    	}
      	项目：重庆建设三员分离【屏蔽协同转邮件】 作者：wxt.fengyunyun 时间：2017年2月15日14:23:58 start */
   
    };
    var toolbarArray = new Array();
    //转发
    if ($.ctx.resources.contains('F01_newColl') || $.ctx.resources.contains('F12_mailcreate')) {
    	toolbarArray.push({id: "transmit",name: $.i18n('collaboration.transmit.label'),className: "ico16 forwarding_16",subMenu: submenu});
    }
    //归档
    if(isPigeonholeBtn() && hasDoc=="true"){
        toolbarArray.push({id: "pigeonhole",name: $.i18n('collaboration.toolbar.pigeonhole.label'),className: "ico16 filing_16",click:  function(){doPigeonhole("pending", grid, "listPending");}});
    }
    //删除
    toolbarArray.push({id: "delete",name: $.i18n('collaboration.button.delete.label'),className: "ico16 del_16",click:deleteCol});
    //批处理
    $.ajax({
        url: '/seeyon/shkkBatchProcessingController.do?method=checkRole',
        type: 'post',
        datatype: 'json',
        async: false, // 同步
        success: function(data) {
        	var result = $.parseJSON(data);
        	if(result.result){
        	toolbarArray.push({id: "batchDeal",name: $.i18n('collaboration.batch.title'),className: "ico16 batch_16",click:batchDeal});
        }},
        error: function() {
         console.log("获取批处理角色请求错误！");
        }
      });   
    //toolbar扩展
    for (var i = 0;i<addinMenus.length;i++) {
        toolbarArray.push(addinMenus[i]);
    }
    //工具栏
    $("#toolbars").toolbar({
        toolbar: toolbarArray
    });
    //搜索框
    var topSearchSize = 7;
    if($.browser.msie && $.browser.version=='6.0'){
        topSearchSize = 10;
    }
    
    //查询条件
    var condition = new Array();
    //标题
    condition.push({id: 'title',name: 'title',type: 'input',text: $.i18n("common.subject.label"),value: 'subject',maxLength:100});
    //模板名称
    condition.push({id: 'templateName', name: 'templateName',type: 'input',text: $.i18n("ctp.dr.template.name.js"),value: 'templateName'});
    //重要程度
    condition.push({id: 'importent',name: 'importent',type: 'select',text: $.i18n("common.importance.label"),value: 'importantLevel',
        items: [{
            text: $.i18n("common.importance.putong"),//普通
            value: '1'
        }, {
            text: $.i18n("common.importance.zhongyao"),//重要
            value: '2'
        }, {
            text: $.i18n("common.importance.feichangzhongyao"),//非常重要
            value: '3'
        }]
    });
    //发起人
    condition.push({id: 'spender',name: 'spender',type: 'input',text: $.i18n("cannel.display.column.sendUser.label"),value: 'startMemberName'});
    //addby libing 上一处理人
    condition.push({id: 'preApproverName',name: 'preApproverName',type: 'input',text: $.i18n("cannel.display.column.preApprover.label"),value: 'preApproverName'});
    //发起时间
    condition.push({id: 'datetime',name: 'datetime',type: 'datemulti',text: $.i18n("common.date.sendtime.label"),value: 'createDate',ifFormat:'%Y-%m-%d',dateTime: false});
    //接受时间
    condition.push({id:'receivetime',name:'receivetime',type:'datemulti',text: $.i18n("cannel.display.column.receiveTime.label"),value:'receiveDate',ifFormat:'%Y-%m-%d',dateTime: false});
    condition.push({id:'nodeDeadLine',name:'nodeDeadLine',type:'datemulti',text:$.i18n("collaboration.process.label"),value:'expectprocesstime',ifFormat:'%Y-%m-%d',dateTime:false});
    condition.push({id:'subState',name:'subState',type:'select',text:$.i18n("collaboration.trans.label"),value:'subState',ifFormat:'%Y-%m-%d',dateTime:false,
    	 items: [{
             text: $.i18n("collaboration.toolTip.label11"),//未读
             value: '11'
         }, {
             text: $.i18n("collaboration.toolTip.label12"),//已读
             value: '12'
         }, {
             text:$.i18n("collaboration.dealAttitude.temporaryAbeyance"),//暂存待办
             value: '13'
         }, {
             text:$.i18n("collaboration.toolTip.label16"),//被回退
             value: '2'
         }, {
             text:$.i18n("collaboration.default.stepBack"),//指定回退
             value: '15'
         }]
    });
    //是否超期:节点超期查询出来。
    condition.push({
    	id:'isOverdue',
    	name:'isOverdue',
    	type:'select',
    	text: $.i18n('collaboration.condition.affairOverdue'), //节点超期
    	value:'isOverdue',
    	items: [{
            text: $.i18n('message.yes.js'),
            value: '1'
        }, {
            text: $.i18n('message.no.js'),
            value: '0'
        }]
    });
    
    //扫一扫
    if (hasBarCode=="true") {
    	condition.push({id:'saoyisao',name:'saoyisao',type:'barcode',text: $.i18n('common.barcode.search.saoyisao'),value:'barcode'});
    }
    		
    searchobj= $.searchCondition({
        top:topSearchSize,
        right:60,
        searchHandler: function(){//chenxd 
            
            var val = searchobj.g.getReturnValue();
            
            if(val != null){
                $("#listPending").ajaxgridLoad(getSearchValueObj());
                var _summarySrc =  $('#summary').attr("src");
                if(_summarySrc.indexOf("listDesc") != -1){
                	setTimeout(function(){
                		$('#summary').attr("src","listDesc.do?method=listDesc&type=listPending&size="+grid.p.total+"&r=" + Math.random());	
                	},1000);
                }
            }
        },
        conditions: condition
    });
  //客开项目：三元分离 [显示协同的文件密级] 作者：wxt.shenchunyou 时间：2016年8月15日  start
    //定义列表栏
	var colModel = new Array();
  	var sm = new secretManager();
	var smp = sm.isSecretManagerPluginStart();
	colModel.push({
  		display: 'id',
        name: 'affairId',
        width: '4%',
        type: 'checkbox',
        isToggleHideShow:false
	});
	colModel.push({
		display: $.i18n("common.subject.label"),//标题
        name: 'subject',
        sortable : true,
        width: '32%'
	});
	colModel.push({
		display: $.i18n("cannel.display.column.sendUser.label"),//发起人
        name: 'startMemberName',
        sortable : true,
        width: '7%'
	});
	colModel.push({
		 display: $.i18n("cannel.display.column.preApprover.label"),//上一处理人
         name: 'preApproverName',
         sortable : true,
         width: '7%'
	});
	colModel.push({
		display: $.i18n("common.date.sendtime.label"),//发起时间
        name: 'startDate',
        sortable : true,
        width: '10%'
	});
	colModel.push({
		display: $.i18n("cannel.display.column.receiveTime.label"),//接收时间
        name: 'receiveTime',
        sortable : true,
        width: '10%'
	});
	colModel.push({
		display: $.i18n("pending.deadlineDate.label"),//处理期限（节点期限）
        name: 'nodeDeadLineName',
        sortable : true,
        width: '9%'
	});
	colModel.push({
		display: $.i18n("collaboration.col.hasten.number.label"),//催办次数
        name: 'hastenTimes',
        sortable : true,
        width: '4%'
	});
	colModel.push({
		display:$.i18n("common.deal.state"),//处理状态
        name: 'subState',
        width: '9%'
	});
	colModel.push({
		display: $.i18n("processLog.list.title.label"),//流程日志
        name: 'processId',
        width: '9%'
	});
	if(smp == 1){
		colModel.push({
			display: '文件密级名称',//文件密级
	        name: 'fileSecretName',
	        sortable : true,
	        width: '5%'
		});
	}
	 //表格加载
   //客开
    grid = $('#listPending').ajaxgrid({
        colModel: colModel,
        click: dbclickRow,
        dblclick: dbclickRow,
        render : rend,
        height: 200,
        showTableToggleBtn: true,
        parentId: $('.layout_center').eq(0).attr('id'),
        vChange: true,
        vChangeParam: {
            overflow: "hidden",
            autoResize:true
        },
        //客开
        isHaveIframe:true,
        slideToggleBtn:true,
        managerName : "colManager",
        managerMethod : "getPendingList"
    });
  //客开项目：三元分离 [显示协同的文件密级] 作者：wxt.shenchunyou 时间：2016年8月15日  end
  
    //表格加载
   /* grid = $('#listPending').ajaxgrid({
        colModel: [{
            display: 'id',
            name: 'affairId',
            width: '4%',
            type: 'checkbox',
            isToggleHideShow:false
        }, {
            display: $.i18n("common.subject.label"),//标题
            name: 'subject',
            sortable : true,
            width: '32%'
        },{
            display: $.i18n("cannel.display.column.sendUser.label"),//发起人
            name: 'startMemberName',
            sortable : true,
            width: '7%'
        },{
            display: $.i18n("cannel.display.column.preApprover.label"),//上一处理人
            name: 'preApproverName',
            sortable : true,
            width: '7%'
        }, {
            display: $.i18n("common.date.sendtime.label"),//发起时间
            name: 'startDate',
            sortable : true,
            width: '10%'
        }, {
            display: $.i18n("cannel.display.column.receiveTime.label"),//接收时间
            name: 'receiveTime',
            sortable : true,
            width: '10%'
        }, {
            display: $.i18n("pending.deadlineDate.label"),//处理期限（节点期限）
            name: 'nodeDeadLineName',
            sortable : true,
            width: '9%'
        }, {
            display: $.i18n("collaboration.col.hasten.number.label"),//催办次数
            name: 'hastenTimes',
            sortable : true,
            width: '8%'
        }, {
            display:$.i18n("common.deal.state"),//处理状态
            name: 'subState',
            width: '8%'
        },{
            display: $.i18n("processLog.list.title.label"),//流程日志
            name: 'processId',
            width: '8%'
        },{
            display:$.i18n("collaboration.current.NodeName.label"),//当前节点名称
            name: 'nodeName',   
            sortable : true,
            width: '7%'
        }],
        click: dbclickRow,
        render : rend,
        height: 200,
        showTableToggleBtn: true,
        parentId: $('.layout_center').eq(0).attr('id'),
        vChange: true,
        vChangeParam: {
            overflow: "hidden",
            autoResize:false //表格下方是否自动显示
        },
        isHaveIframe:true,
        slideToggleBtn:true,
        managerName : "colManager",
        managerMethod : "getPendingList"
    });*/
    //页面底部说明加载
    $('#summary').attr("src",_ctxPath + "/collaboration/listDesc.do?method=listDesc&type=listPending&size="+grid.p.total+"&r=" + Math.random());



});

function loadPendingGrid() {
    $("#listPending").ajaxgridLoad();
}

//判断当前窗口是否打开了
function exitWinOpen(affairId) {
    var _wmp = getCtpTop()._windowsMap;
    if(_wmp){
    	//参考common-debug.js修改
    	try{
    	   var _wmpKeys= _wmp.keys();
    	}catch(e){//兼容处理，为了解决bug：OA-80754公司协同：连续打开2个新闻、2个公告，页签不关闭，这时，首页待办栏目中的标题点不动，栏目空间都可以刷新。
    	   getCtpTop()._windowsMap= new Properties();
    	   _wmp = getCtpTop()._windowsMap;
    	}
    	
        //不存在的情况删除之前打开的信息
        for(var p = 0;p<_wmp.keys().size();p++){
            var _kkk = _wmp.keys().get(p);
            try{
                var _fff = _wmp.get(_kkk);
                var _dd = _fff.document;
                if(_dd){
                    var _p = parseInt(_dd.body.clientHeight);
                    if(_p == 0){
                        _wmp.remove(_kkk);
                        p--;
                    }
                }else{
                    _wmp.remove(_kkk);
                    p--;
                }
            }catch(e){
                _wmp.remove(_kkk);
                p--;
            }
        }
        var exitWin = _wmp.get(affairId);
        if(exitWin){
            try{
                alert($.i18n("window.already.exit.js"));
                exitWin.focus();
                return false;
            }catch(e){
            }
        }
    }

    return true;
}

function colseQuery() {
    try{
        var dialogTemp=window.parentDialogObj['queryDialog'];
        dialogTemp.close();
    }catch(e){
    }
}

//二维码传参chenxd
function precodeCallback(){
	var obj = getSearchValueObj();
	obj.openFrom = "listPending";
	return obj;
}

function getSearchValueObj(){
	o = new Object();
    var templeteIds = $.trim(_paramTemplateIds);
    if(templeteIds != ""){
        o.templeteIds = templeteIds;
    }
    var choose = $('#'+searchobj.p.id).find("option:selected").val();
    if(choose == 'subject'){
        o.subject = $('#title').val();
    }else if(choose == 'templateName'){
        o.templateName = $('#templateName').val();
    }else if(choose == 'importantLevel'){
        o.importantLevel = $('#importent').val();
    }else if(choose == 'startMemberName'){
        o.startMemberName = $('#spender').val();
    }else if(choose == 'preApproverName'){
    	o.preApproverName = $("#preApproverName").val();
    }else if(choose == 'createDate'){
        var fromDate = $('#from_datetime').val();
        var toDate = $('#to_datetime').val();
        if(fromDate != "" && toDate != "" && fromDate > toDate){
            $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
            return;
        }
        var date = fromDate+'#'+toDate;
        o.createDate = date;
    }else if(choose == 'receiveDate'){
        var fromDate = $('#from_receivetime').val();
        var toDate = $('#to_receivetime').val();
        if(fromDate != "" && toDate != "" && fromDate > toDate){
            $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
            return;
        }
        var date = fromDate+'#'+toDate;
        o.receiveDate = date;
    }else if(choose == 'expectprocesstime'){
        var fromDate = $('#from_nodeDeadLine').val();
        var toDate = $('#to_nodeDeadLine').val();
        if(fromDate != "" && toDate != "" && fromDate > toDate){
            $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
            return;
        }
        var date = fromDate+'#'+toDate;
        o.expectprocesstime = date;
    }else if(choose == 'subState'){
    	o.subState=$('#subState').val();
    }else if(choose == 'isOverdue') {
    	o.isOverdue = $("#isOverdue").val();
    }
    if(window.location.href.indexOf("condition=templeteAll&textfield=all") != -1){
		o.templeteAll="all";
	}
    return o;
}